<?php
include("../config.php");
$encode = base64_encode($_SERVER["REMOTE_ADDR"]);
$json = json_decode(file_get_contents("./Cache/admin.txt"),true);
$Cache_pwd=$json[$encode]?$json[$encode]:"0";
if($Cache_pwd>time())
{
exit("<script language='javascript'>alert('您已登陆！');window.location.href='./';</script>");
}
elseif(isset($_POST['user']) && isset($_POST['pass']))
{
$user=$config["admin"]["admin_user"];
$pass=$config["admin"]["admin_pass"];
if($_POST['user']==$user && $_POST['pass']==$pass)
{
write_dic("admin",$_SERVER["REMOTE_ADDR"],(time()+600));
exit("<script language='javascript'>alert('登陆管理中心成功！');window.location.href='./';</script>");
}
else
{
exit("<script language='javascript'>alert('用户名或密码不正确！');history.go(-1);</script>");
}
}
?>

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title><?php echo $web["ming"]; ?>API - 后台登录</title>
<link rel="icon" href="http://q2.qlogo.cn/headimg_dl?dst_uin=<?php echo $web["qq"]; ?>&spec=5" type="image/ico">
<meta name="keywords" content="<?php echo $web["keywords"]; ?>">
<meta name="description" content="<?php echo $web["description"]; ?>">
<meta name="author" content="yinqi">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/materialdesignicons.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<style>
.lyear-wrapper {
    position: relative;
}
.lyear-login {
    display: flex !important;
    min-height: 100vh;
    align-items: center !important;
    justify-content: center !important;
}
.login-center {
    background: #fff;
    min-width: 38.25rem;
    padding: 2.14286em 3.57143em;
    border-radius: 5px;
    margin: 2.85714em 0;
}
.login-header {
    margin-bottom: 1.5rem !important;
}
.login-center .has-feedback.feedback-left .form-control {
    padding-left: 38px;
    padding-right: 12px;
}
.login-center .has-feedback.feedback-left .form-control-feedback {
    left: 0;
    right: auto;
    width: 38px;
    height: 38px;
    line-height: 38px;
    z-index: 4;
    color: #dcdcdc;
}
.login-center .has-feedback.feedback-left.row .form-control-feedback {
    left: 15px;
}
</style>
</head>
  
<body>
<div class="row lyear-wrapper">
  <div class="lyear-login">
    <div class="login-center">
      <div class="login-header text-center">
      <h1><?php echo $web["ming"]; ?>API后台登陆</h3>
      </div>
       <form action="./login.php" method="POST" role="form" class="form-horizontal">
        <div class="form-group has-feedback feedback-left">
          <input type="text" name="user" placeholder="请输入用户名称" class="form-control"/>
          <span class="mdi mdi-account form-control-feedback" aria-hidden="true"></span>
        </div>
        <div class="form-group has-feedback feedback-left">
          <input type="password" name="pass" placeholder="请输入用户密码" class="form-control"/>
          <span class="mdi mdi-lock form-control-feedback" aria-hidden="true"></span>
        </div>
        <div class="form-group has-feedback feedback-left row">
          <button class="btn btn-block btn-primary"  type="submit" id="pages_login">立即登录</button>
        </div>
      </form>
      <hr>
      <footer class="col-sm-12 text-center">
        <p class="m-b-0">Copyright © 2022 <a href="">囍楽API</a></p>
      </footer>
</form>
    </div>
  </div>
</div>
<script src="./js/layer.js"></script>
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
</body>
</html>